$(function () {
    setIcon(localStorage.getItem('selected'));
});

function chooseTab(tab) {
    setIcon(tab);
}

function setIcon(selected) {
    if (!selected) selected = 'home';
    switch (selected) {
        case 'home':
            $('.home').attr('src', './icon/home-choose.png');
            $('.user').attr('src', './icon/user.png');
            $('.service').attr('src', './icon/service.png');
            break;
        case 'service':
            $('.home').attr('src', './icon/home.png');
            $('.user').attr('src', './icon/user.png');
            $('.service').attr('src', './icon/service-choose.png');
            break;

        case 'user':
            $('.home').attr('src', './icon/home.png');
            $('.service').attr('src', './icon/service.png');
            $('.user').attr('src', './icon/user-choose.png');
            break;
    }
}